<?php
/**
 * User: LSM
 * Time: 12-10-13 - 上午9:14
 * File: list.inc.php
 * Project For ixdcw.com
 */
/**
 * 2013-4-1 Sameal add order by cityid an group level
 */
defined('IN_IXDCW') or exit('Access Denied');
require DT_CORE.'/'.MODULE_NAME.'/common.inc.php';
//引用公共头部模版
require DT_CORE.'/buyhelp/common.inc.php';
$navname='quote';
//满足条件时,根据cookie传入的$cartypeid给 $filter赋值
    if ($cartypeid == 1) {
        $filter['ctp'] = 433;
    }
    if ($cartypeid == 2) {
        $filter['ctp'] = 434;
    }
    if ($cartypeid == 3) {
        $filter['ctp'] = 435;
    }
    if ($cartypeid == 4) {
        $filter['cen'] = 432;
        $filter['ctp']='';
    }
//关联车型库找出乘用车等下的车款,品牌;并赋值给 $condition
require_once DT_INC . '/search/listAuto.inc.php';
//$BRANDS_S =  $BRANDS ? $BRANDS : '';
$condition = "status=3";
// 地区搜索.
if($cityid) {
	$condition .=  " AND (city like '%|".$cityid."|%' or city like '%|0|%') ";
}
//判断是到店预订，还是优惠促销的。
if (!empty($CAT)) {
	$condition .= ($CAT['child']) ? " AND catid IN (" . $CAT['arrchildid'] . ")" : " AND catid=$catid ";
}
$order = 'addtime DESC';
if ($autoFilter) {
	$carids   = $carids ? $carids : array('-');
	$brandids = $brandids ? $brandids : array('-');
	$condition .= " and arcid in (" . Sql::in($carids) . ")";
	//$condition .= " and arbid in (" . Sql::in($brandids) . ")";
}
////搜索
if ($kw) {
    $condition .= " AND title LIKE '%$kw%'";
}
$total    = $db->count($table, $condition, $DT['cache_search']);
$do = new QuoteModule($moduleid);

if ($total) {
    //需要的字段。
    $fields='title,itemid,addtime,edittime';
	$tags=$do->getList($condition,$order,($DT['cache_search'] && $page == 1) ? 'CACHE' : '',60, $fields);
    if($page == 1 && $kw) keyword($kw, $items, $moduleid);
}
$pn = new Pagination();
$pn->recordsPerPage(60);
$pn->records($items);
$MOD['name'] = '买车助手_行情';
$seo_file = 'list';
include DT_INC.'/seo.inc.php';
include template('list', MODULE_NAME);